<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>hbase-jruby</groupId>
  <artifactId>hbase-project</artifactId>
  <version><%= HBase::JRuby::VERSION %></version>
  <packaging>jar</packaging>

  <name>hbase-jruby</name>

  <profiles>
    <% { 'cdh5.0' => ['2.3.0', '0.96.1.1'],
         'cdh5.1' => ['2.3.0', '0.98.1'  ],
         'cdh5.2' => ['2.5.0', '0.98.6'  ]}.each do |cdh, (hadoop_version, hbase_version)| %>
    <profile>
      <id><%= cdh %></id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hadoop.version><%= hadoop_version %>-<%= profiles[cdh] %></hadoop.version>
        <hbase.version><%= hbase_version %>-<%= profiles[cdh] %></hbase.version>
      </properties>
      <repositories>
        <repository>
          <id>cloudera-releases</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
          <version>${hadoop.version}</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase-client</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>
    <% end %>

    <% %w[cdh4.6 cdh4.5 cdh4.4 cdh4.3].each do |cdh| %>
    <profile>
      <!-- http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH-Version-and-Packaging-Information/cdhvd_topic_8.html -->
      <id><%= cdh %></id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hadoop.version>2.0.0-<%= profiles[cdh] %></hadoop.version>
        <hbase.version>0.94.6-<%= profiles[cdh] %></hbase.version>
      </properties>
      <repositories>
        <repository>
          <id>cloudera-releases</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
          <version>${hadoop.version}</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>
    <% end %>

    <profile>
      <id>cdh4.2</id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hadoop.version>2.0.0-<%= profiles['cdh4.2'] %></hadoop.version>
        <hbase.version>0.94.2-<%= profiles['cdh4.2'] %></hbase.version>
      </properties>
      <repositories>
        <repository>
          <id>cloudera-releases</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
          <version>${hadoop.version}</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>cdh4.1</id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hadoop.version>2.0.0-<%= profiles['cdh4.1'] %></hadoop.version>
        <hbase.version>0.92.1-<%= profiles['cdh4.1'] %></hbase.version>
      </properties>
      <repositories>
        <repository>
          <id>cloudera-releases</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
          <version>${hadoop.version}</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>cdh3</id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hbase.version>0.90.6-<%= profiles['cdh3'] %></hbase.version>
        <hadoop.version>0.20.2-<%= profiles['cdh3'] %></hadoop.version>
      </properties>
      <repositories>
        <repository>
          <id>cloudera-releases</id>
          <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>

      <dependencies>
        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>

    <% %w[0.95 0.96 0.98].each do |version| %>
    <profile>
      <id><%= version %></id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hbase.version><%= profiles[version] %></hbase.version>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <% if profiles[version] =~ /hadoop2/ %>
          <artifactId>hadoop-common</artifactId>
          <version>2.2.0</version>
          <% else %>
          <artifactId>hadoop-core</artifactId>
          <version>1.2.1</version>
          <% end %>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase-client</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>
    <% end %>

    <% %w[0.92 0.94].each do |version| %>
    <profile>
      <id><%= version %></id>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hadoop.version>1.2.1</hadoop.version>
        <hbase.version><%= profiles[version] %></hbase.version>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-core</artifactId>
          <version>${hadoop.version}</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
          <groupId>org.apache.hbase</groupId>
          <artifactId>hbase</artifactId>
          <version>${hbase.version}</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>
    <% end %>
  </profiles>
</project>

